﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Itop.YHPC.Model;
using Itop.YHPC.controller;

namespace Itop.YHPC.admin {
    public partial class sysprogAjax :AjaxPage<sysprog> {
        protected override IList<sysprog> onRead() {
            string str=null;
            string groupid = Request["groupid"];
            if (!string.IsNullOrEmpty(groupid))
                str = "where isgroup='0' order by orderid";
            else {
                str = " order by orderid";
            }
            return sysprogController.GetList(str);
        }
        protected override bool onCreate(IList<sysprog> list) {
            foreach (sysprog obj in list) {
                obj.id = obj.CreateID();
                sysprogController.Insert(obj);
            }
            return true;
        }
        protected override bool onUpdate(IList<sysprog> list) {
            foreach (sysprog obj in list) {

                sysprogController.Update(obj);
            }
            return true;
        }

        protected override bool onDelete(IList<sysprog> list) {
            foreach (sysprog obj in list) {
                sysprogController.Delete(obj.id);
            }
            return true;
        }
    }
}
